package com.bwie.controller;

import com.bwie.pojo.TbCoupon;
import com.bwie.service.TbCouponService;
import com.bwie.utils.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author : Yoo19
 * @description :
 * @createDate : 2025/7/15 12:02 02
 */
@RestController
@RequestMapping("/user/coupon")
public class CouponController {
    @Autowired
    private TbCouponService tbCouponService;

    /**
     * 优惠卷列表
     * @return
     */
    @ApiOperation("优惠卷列表")
    @PostMapping("/getCouponList")
    public R getCouponList(){
        return tbCouponService.getCouponList();
    }

    /**
     * 查询用户的优惠卷
     * @return
     */
    @ApiOperation("查询用户的优惠卷")
    @PostMapping("/getUserCoupon")
    public R getUserCoupon(){
        return tbCouponService.getUserCoupon();
    }

    @ApiOperation("添加优惠卷")
    @PostMapping("/addCoupon")
    public R addCoupon(@RequestBody TbCoupon tbCoupon){
        return tbCouponService.addCoupon(tbCoupon);
    }
    @ApiOperation("修改优惠卷")
    @PostMapping("/updateCoupon")
    public R updateCoupon(@RequestBody TbCoupon tbCoupon){
        return tbCouponService.updateCoupon(tbCoupon);

    }
    @ApiOperation("删除优惠卷")
    @PostMapping("/deleteCoupon/{couponId}")
    public R deleteCoupon(@PathVariable("couponId") Integer couponId){
        return tbCouponService.deleteCoupon(couponId);
    }
}
